home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 1 Issue 2 / PDCD-1 - Issue 02.iso / _utilities / utilities / 004 / _adhesive / tools / h / Adhesive next >
Text File  |  1994-09-22  |  5KB  |  187 lines

  1. /***************************************************************************
  2.  
  3.                 Adhesive (C) 1994 George Taylor
  4.                 -------------------------------
  5.  
  6.         Title:   adhesive.h
  7.  
  8.         Purpose: Access to shared objects
  9.  
  10.         Author:  George Taylor
  11.  
  12.         Version: 1.00
  13.  
  14. ***************************************************************************/
  15.  
  16. #pragma include_only_once
  17.  
  18. #ifndef __ADHESIVE
  19. #define __ADHESIVE
  20.  
  21. #include "kernel.h"    /* needed for _kernel_oserror */
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. /* If you are using the 'o.Adhesive' file and CAHG then please skip to the
  29.    end of this file for the procedures provided in 'o.Adhesive'.
  30. */
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. typedef unsigned int Adhesive_ObjectNum;  /* abstract object number */
  39. typedef unsigned int Adhesive_EntryNum;   /* abstract entry point number */
  40.  
  41.  
  42. /* flags for an Adhesive_Object */
  43. /* none currently defined */
  44. typedef enum {
  45.   Adhesive_Object_DUMMY = 0x0
  46. } Adhesive_ObjectFlags;
  47.  
  48. /* header at the start of an object */
  49. typedef struct {
  50.   unsigned int  reloccode;    /* B __RelocCode */
  51.   unsigned int  initcode;    /* B initcode */
  52.   unsigned int    finalcode;    /* B finalcode */
  53.   Adhesive_ObjectFlags flags;    /* misc flags */
  54.   unsigned int  reserved[4];    /* reserved entries, must all be 0 */
  55.   unsigned int  numbranches;    /* number of branches in branch table */
  56.   unsigned int  numpairs;    /* number of pairs to follow */
  57.   /* Next in memory comes a list of pairs to specify ranges of entry points
  58.      available. Each pair takes two integers.
  59.      unsigned int [numpairs*2]
  60.   */
  61.  
  62.   /* Following this there should be an array.
  63.      unsigned int [num]
  64.      This array should contain 'B procedure' for each entry point.
  65.   */
  66. } Adhesive_Object;
  67.  
  68.  
  69.  
  70. /* flags for an Adhesive_Request */
  71. /* none currently defined */
  72. typedef enum {
  73.   Adhesive_Request_DUMMY = 0x0
  74. } Adhesive_RequestFlags;
  75.  
  76. /* request for an object */
  77. typedef struct {
  78.   Adhesive_ObjectNum object;    /* object number requested, 0 to mark end */
  79.   unsigned int  min,        /* minimum version */
  80.           max;        /* maximum version */
  81.   Adhesive_RequestFlags flags;    /* misc flags */
  82.   unsigned int numbranches;    /* number of branches in branch table */
  83.   unsigned int numpairs;    /* number of pairs to follow */
  84.  
  85.   /* Next in memory comes a list of pairs to specify ranges of entry points
  86.      wanted. Each pair takes two integers.
  87.      unsigned int [numpairs*2]
  88.   */
  89.  
  90.   /* Following this there should be an array.
  91.      unsigned int [X]
  92.      where X depends on the pairs.
  93.      The contents of this array are filled in with branch (B) instructions
  94.      to the entry points of the requested object.
  95.   */
  96. } Adhesive_Request;
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110. /* If you are using the supplied 'o.Adhesive' file and CAHG
  111.    you will not need to bother with the details of what is above.
  112. */
  113.  
  114.  
  115. typedef unsigned int Adhesive_User;       /* abstract user handle */
  116.  
  117. /* Nice and simple interface to Adhesive SWI's. It does not do stack
  118.    checking and does not refer to any external symbols.
  119. */
  120.  
  121. /* flags for a user, none currently defined */
  122. typedef enum {
  123.   Adhesive_UserFlags_DUMMY = 0x0
  124. } Adhesive_UserFlags;
  125.  
  126.  
  127. /* structure describing user */
  128. typedef struct {
  129.   Adhesive_UserFlags flags;     /* various flags, undefined bits must be 0 */
  130.   char         *name; /* ptr to a name (any length) describing who you are */
  131. } Adhesive_UserInfo;
  132.  
  133.  
  134. /* Procedure:    adhesive_Register
  135.  *
  136.  * Description: Registers a new user with Adhesive if the passed pointer
  137.  *        points to NULL. Else does nothing.
  138.  *
  139.  * Parameters:    Adhesive_User *user
  140.  *            Pointer to place to put handle, if *user is already
  141.  *            a non-zero value then no action is taken.
  142.  *        Adhesive_UserInfo *info
  143.  *            A description of who you are.
  144.  *
  145.  * Returns:    _kernel_oserror *
  146.  *            NULL if no error or a pointer to a error block
  147.  *            if an error occurred.
  148.  */
  149. _kernel_oserror *adhesive_Register(Adhesive_User *user,Adhesive_UserInfo *info);
  150.  
  151.  
  152. /* Procedure:    adhesive_Deregister
  153.  *
  154.  * Description:    Tell Adhesive you are no longer wanting previously
  155.  *        requested objects.
  156.  *
  157.  * Parameters:    Adhesive_User *user
  158.  *            Pointer to handle, if *user is NULL no action is taken.
  159.  *
  160.  * Returns:    _kernel_oserror *
  161.  *             Sets *user to 0 regardless of error status.
  162.  *
  163.  * Other Info:    You should not use any objects requested using the handle
  164.  *        at *user after making this call even if this call returns
  165.  *        an error.
  166.  */
  167. _kernel_oserror *adhesive_Deregister(Adhesive_User *user);
  168.  
  169.  
  170. /* Procedure:    adhesive_Request
  171.  *
  172.  * Description:    Request some objects.
  173.  *
  174.  * Parameters:    Adhesive_User *user
  175.  *            Pointer to handle, if *user is NULL no action is taken.
  176.  *        Adhesive_Request *table
  177.  *            Request table.
  178.  *
  179.  * Returns:    _kernel_oserror *
  180.  *
  181.  */
  182. _kernel_oserror *adhesive_Request(Adhesive_User *user,Adhesive_Request *table);
  183.  
  184.  
  185.  
  186. #endif
  187.